package com.example.vip1.jianzaozhe;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 8/15/21 3:39 PM
 * Name:设计师
 * Overview:
 * 23 种设计模式详解（全23种）
 * https://blog.csdn.net/A1342772/article/details/91349142
 * Usage:
 * *******************************************************
 */
public class Designer2 {
    private Mpaint mMpaint;
    private Worker mWorker;

    public Designer2() {
        mMpaint = new Mpaint();
        mWorker = new Worker();
    }

    /**
     * 给图纸添加高度
     * @param height
     */
    public Designer2 addHeight(double height) {
        mMpaint.setHeight(height);
        return this;
    }

    /**
     * 给图纸添加高度
     * @param width
     */
    public Designer2 addWidth(double width) {
        mMpaint.setWidth(width);
        return this;
    }


    public Designer2 setColor(String color) {
        mMpaint.setColor(color);
        return this;

    }

    //将图纸交给工人，工人去创建房子，然后把房子交给设计师，设计师交给用户

    public House build(){
        mWorker.setMpaint(mMpaint);
        return mWorker.buildHouse();
    }

}
